<?php
namespace modules\game\services;

use modules\game\services\observer\IObserver;

class Person extends IObserver{
	public static $_noPoker = false;//是否牌已经打完
	public static $_winner  = '';//胜者名称
	public $_strategy;
	public $_rule;
	public $_name       = '';//我的名字
	public $_mypoker    = [];//我的牌
	public $_lastPoker  = [];//上次出的牌
	public $_isKing 	= false;//是否地主
	public $_isPower 	= false;//是否先出牌
	public $_order   	= 0; //出牌顺序  轮询

	public function __clone(){

	}
	public function __construct(Strategy $strategy){
		$this->_strategy = $strategy;
	}

	//用户出牌 观察者
	public function play(){//注意逻辑顺序必须如此
		//压牌
		if($this->_rule->_outPoker){
			$this->suppress();
		} elseif($this->_isPower){ 	//出牌
			$this->out();
		}

	}
	//出牌
	public function out(){
		$this->_strategy->out($this);
	}
	//压牌
	public function suppress(){
		$this->_strategy->suppress($this);
	}
}